package au.com.iglootech.TaxTimeToolTip.service.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import au.com.iglootech.TaxTimeToolTip.Entity.Company;
import au.com.iglootech.TaxTimeToolTip.dao.GenericDao;
import au.com.iglootech.TaxTimeToolTip.service.CompanyService;

import com.google.appengine.api.datastore.Key;

@Component(CompanyServiceImpl.BEANNAME)
public class CompanyServiceImpl implements CompanyService {
	public static final String BEANNAME="CompanyServiceImpl";
	
	@Autowired
	private transient GenericDao genericDao;

	@Override
	public Company createCompany(Company company) {
		return genericDao.save(company);
	}

	@Override
	public List<Company> findAllCompany() {
		return new ArrayList<Company>(genericDao.findAll(Company.class));
	}

	@Override
	public Company findById(Key key) {
		// TODO Auto-generated method stub
		return genericDao.findByKey(Company.class, key);
	}

}
